<template>
  <a-form :model="model" :wrapper-col="wrapperCol" :layout="layout" :rules="rules">
    <template v-for="item in options">
      <a-form-item :label="item.title" :name="item.dataIndex" :required="!nullDefaultTrue(item.required)" :rules="item.rules"
                   :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" label-align="left">
        <madoka-select v-if="item.type ==='select'" :options="item.select?.options"
                           :mode="item.select?.mode"></madoka-select>
        <a-button v-else-if="item.type === 'button'" >{{item.button.title}}</a-button>
        <a-input v-else v-model:value="model[item?.dataIndex ?? '']" :placeholder="item.placeholder ?? `请输入${item.title}`"
                 :type="item.input?.type"></a-input>
      </a-form-item>
    </template>
    <slot v-if="slots.default" :model="model"></slot>
  </a-form>
</template>
<script setup lang="ts">
import type {IMadokaAntForm} from "@/types/antd";
import {nullDefaultTrue} from "@/madoka";

const slots = defineSlots()
const props = defineProps<IMadokaAntForm>()
const modelValue = ref([])
const startTime = defineModel("start",{
  default: ""
})
const endTime = defineModel("end", {
  default: ""
})
const reset = () => {
  params = {...defaultParams}
}
</script>
<style scoped lang="scss">

</style>